home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / bin / cleanlinks < prev    next >
Encoding:
Text File  |  2006-12-20  |  615 b   |  28 lines

  1. #!/bin/sh
  2. #
  3. # Copyright ┬⌐ 2000, 2003 by The XFree86 Project, Inc
  4. # Remove dangling symlinks and empty directories from a shadow link tree
  5. # (created with lndir).
  6. #
  7. # Author: David Dawes <dawes@xfree86.org>
  8. #
  9. # $XFree86: xc/config/util/cleanlinks.sh,v 1.2 2003/04/15 03:05:16 dawes Exp $
  10.  
  11. find . -type l -print |
  12. (
  13.     read i
  14.     while [ X"$i" != X ]; do
  15.         if [ ! -f "$i" ]; then
  16.             echo $i is a dangling symlink, removing
  17.             rm -f "$i"
  18.         fi
  19.         read i
  20.     done
  21. )
  22.  
  23. echo Removing empty directories ...
  24. #find . -type d -depth -print | xargs rmdir > /dev/null 2>&1
  25. find . -type d -depth -empty -print -exec rmdir {} \;
  26. exit 0
  27.